package com.middlegroup.payadmin.service.impl;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.middlegroup.payadmin.mapper.MerchantMapper;
import com.middlegroup.payadmin.pojo.dto.DataGrid;
import com.middlegroup.payadmin.pojo.po.Merchant;
import com.middlegroup.payadmin.service.MerchantService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 * 商户表 服务实现类
 * </p>
 *
 * @author pc123
 * @since 2019-01-04
 */
@Service
public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> implements MerchantService {

    @Resource
    private MerchantMapper merchantMapper;

    @Override
    public PageInfo<Merchant> getMerchantList(DataGrid grid, Merchant merchant) {
        grid.getOrderBy();
        return PageHelper.startPage(grid.getPageNum(), grid.getPageSize())
                .doSelectPageInfo(() -> this.merchantMapper.getMerchantList(merchant));
    }
}
